<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="${pageContext.request.contextPath}/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
<style type="text/css">
.contain{width:740px;  margin:100px auto;  color:#636864; background:#fff; padding: 0 40px; padding-bottom: 30px; box-shadow: -2px 0 10px rgba(0, 0, 0, .1);}
.contain h3{line-height: 40px;
   font-size: 14px;
   color: #333;
   border-bottom: 1px dashed #bcbcbc;}
   .account-table {
   width: 100%;
   line-height: 40px;
   color: #666;
   margin-top: 20px;
   border-collapse:collapse;
}
   .account-table td:first-child {
   width: 128px;
   background-color: #efefef;
}

.account-table td {
    border: 1px solid #e2e2e2;
    text-align: center;
    font-size: 14px;
}
</style>
</head>
<body>
<shiro:hasRole name="admin">
	<div style="overflow:hidden;">
			<div class="contain">
				<h3 class="title">账户信息</h3>
				<table class="account-table" border="0" cellspacing="0" cellpadding="0">
				    <tbody>
					    <tr>
					        <td>账户号</td>
					        <td id="accountNoPu"></td>
					    </tr>
					    <tr>
					        <td>账户类型</td>
					        <td id="accType"></td>
					    </tr>
					    <tr>
					        <td>状态</td>
					        <td id="status"></td>
					    </tr>
					    <tr class="accPerson">
					        <td>银行卡号</td>
					        <td id="cardNo"></td>
					    </tr>
					    <tr class="accPerson">
					        <td>持卡人姓名</td>
					        <td id="cardName"></td>
					    </tr>
					    <tr class="accPublic">
					        <td>企业名称</td>
					        <td id="corpName"></td>
					    </tr>
					    <tr class="accPublic">
					        <td>企业统一信用代码</td>
					        <td id="corpCode"></td>
					    </tr>
					    <tr class="accPublic">
					        <td>企业银行账号</td>
					        <td id="corpAccNo"></td>
					    </tr>
				    </tbody>
				</table>
			</div>
			<div class="contain">
				<h3 class="title">账户余额</h3>
				<table class="account-table" border="0" cellspacing="0" cellpadding="0">
				    <tbody>
				    <tr>
				        <td>账户号</td>
				        <td id="accountNo"></td>
				    </tr>
				    <tr>
				        <td>可用余额(元)</td>
				        <td id="balance"></td>
				    </tr>
				    <tr>
				        <td>挂账余额(元)</td>
				        <td id="billAmt"></td>
				    </tr>
				    <tr>
				        <td>冻结金额(元)</td>
				        <td id="frozenAmt"></td>
				    </tr>
				    </tbody>
				</table>
			</div>
	</div>
</shiro:hasRole>
<shiro:lacksRole name="admin">
	<div style="width: 600px;margin: 200px auto;">
		<img src="${pageContext.request.contextPath}/img/quanxian.png" width="600px">
	</div>
</shiro:lacksRole>
<script src="${pageContext.request.contextPath}/js/jquery.min.js?v=2.1.4"></script>
<script src="${pageContext.request.contextPath}/js/plugins/layer/layer.min.js"></script>
<script src="${pageContext.request.contextPath}/js/public/ttbj-core.js"></script>
<script type="text/javascript">
$(function () {
<shiro:hasRole name="admin">
	$.ajax({
        url: "../company/balanceQuery.htm",
        cache: false,
        async : true,
        type: "get",
        dataType: "json",
        beforeSend:function(){var index = layer.load(1, { shade: [0.8,'#ddd']});},
        complete:function(){var index = layer.closeAll("loading");},
        success: function (result) {
            if (result.status == 0) {	//如果正常返回，则显示出值
                var data = result.data;
                $('#accountNo').text(data.accountNo);
                $('#balance').text(data.balance);
                $('#billAmt').text(data.billAmt);
                $('#frozenAmt').text(data.frozenAmt);
            }else if(result.status == 1){
            	layer.msg(result.message, {icon: 7});
            }else if(result.status == 401){	//如果无权限
            	layer.msg(result.message, {icon: 2});
            }else if(result.status == 40000){	//如果参数有问题，则提示开户
            	layer.msg(result.message, {icon: 7});
            }
            return;
        }
    });
	$.ajax({
	    url: "../company/companyAccQuery.htm",
	    cache: false,
	    async : true,
	    type: "get",
	    dataType: "json",
	    success: function (result) {
	       console.log(result);
	       if (result.status == 0) {
	    	   var data2 = result.data;
	    	   $('#accountNoPu').text(data2.accountNo);
               $('#accType').text(data2.accType);
               $('#status').text(data2.status);
               $('#cardNo').text(data2.cardNo);
               $('#cardName').text(data2.cardName);
               $('#corpName').text(data2.corpName);
               $('#corpCode').text(data2.corpCode);
               $('#corpAccNo').text(data2.corpAccNo);
	    	   if(data2.accType=="00"){
	    		   $('#accType').text("对私");
	    		   $(".accPublic").hide();
	    	   }else if(data2.accType=="01"){
	    		   $('#accType').text("对公");
	    		   $(".accPerson").hide();
	    	   }
	    	   if(data2.status=="01"){
	    		   $('#status').text("正常");
	    	   }else if(data2.status=="02"){
	    		   $('#status').text("冻结");
	    	   }
	       }
	    }
	});
});
</shiro:hasRole>
</script>
</body>
</html>